<script setup lang="ts">
import type { TableQueryProps } from './index'
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'

withDefaults(defineProps<TableQueryProps>(), {
  showAdvancedFilter: false,
})

const emit = defineEmits(['reset', 'search'])

const expand = $ref(false)
</script>

<template>
  <div class="table-query-content">
    <slot name="default" v-bind="{ expand }" />
    <div class="table-query-btn">
      <sy-search-button @search="emit('search')" @reset="emit('reset')" />
      <div
        class="advancedFilter"
        @click="expand = !expand"
      >
        <el-icon v-if="expand">
          <ArrowUp />
        </el-icon>
        <el-icon v-else>
          <ArrowDown />
        </el-icon>
        高级筛选
      </div>
    </div>
  </div>
</template>

<style scoped>
.table-query-content {
  .table-query-btn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    .advancedFilter {
      cursor: pointer;
      margin-left: 15px;
      font-size: 12px;
      color: var(--sy-color-primary);
      display: flex;
      align-items: center;
      gap: 5px;
    }
  }
}

:deep .sy-form--inline .sy-form-item {
  margin-right: 0;
}
</style>
